#include "timedSimulationDialog.h"
#include "ui_timedSimulationDialog.h"

TimedSimulationDialog::TimedSimulationDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::TimedSimulationDialog)
{
    ui->setupUi(this);
    ui->comboBox->clear();

    ui->comboBox->addItem(tr("samochodów"));
    ui->comboBox->addItem(tr("minut"));
    ui->comboBox->addItem(tr("sekund"));
}

int TimedSimulationDialog::getMaxCars()
{
    if (tr("samochodów") == ui->comboBox->currentText())
        return ui->spinBox->value();
    else
        return -1;
}

int TimedSimulationDialog::getMaxTime()
{
    if (tr("minut") == ui->comboBox->currentText())
        return ui->spinBox->value() * 60 * 10;
    else if (tr("sekund") == ui->comboBox->currentText())
        return ui->spinBox->value() * 10;
    else
        return -1;
}

TimedSimulationDialog::~TimedSimulationDialog()
{
    delete ui;
}
